package org.darkforest.dao.mapper;

import org.darkforest.dao.annotation.DBMapper;
import org.darkforest.model.Order;
import org.darkforest.model.OrderSearchBean;
import org.darkforest.model.OrderVo;
import org.darkforest.vo.MemberConsumptionStatisticVo;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@DBMapper
public interface OrderMapper {
    int deleteByPrimaryKey(Integer orderId);

    int insert(Order record);

    int insertSelective(Order record);

    Order selectByPrimaryKey(Integer orderId);

    int updateByPrimaryKeySelective(Order record);

    int updateByPrimaryKey(Order record);

    int updateOrderStatusByOrderSN(Order record);
    
    List<OrderVo> selectByBuyerIdLimit(OrderSearchBean bean);
    
//    int selectByBuyerIdCount(int buyerId);
    
    OrderVo selectById(Map<String, Integer> param);

    OrderVo selectVoById(int id);
    
    List<Map<String, Object>> selectByOrderSimpleCount(Integer memberId);

    List selectListByCondition(OrderSearchBean bean);

    /**
     * 根据订单条件查询订单信息
     * @param order
     * @return
     */
    List<Order> findOrderInfoByCondition(Order order);

    Integer getOrderCount(Integer nearWeek);

    Order  getOrderBySn(String orderSn);


    List<Order> CancleUnpayOrderList();

    void updateOrderStatusByBatch(Map<String, Object> map);
    List<Order> getOrderByPayno(String payNo);

    List<Map<String,Object>> findTransactionInfo(Integer storeId);

    List<Order> selectNotReceiveAndTimeoutOrder();

    List<Map<String,Object>> findGoodsTop30ByCondition(Order order);

    List<Map<String,Object>> findAmountByCondition(Order order);

    List<Map<String,Object>> findIndexByCondition(Order order);

    List<Order> selectOrderListByDateCondition(OrderSearchBean order);

    List<Map<String, Object>> staticsOrderAmountByDateCondition(OrderSearchBean order);

    List<Map<String, Object>> staticsOrderCountAndAmountByDateCondition(OrderSearchBean order);

    List<Map<String,Object>> staticsOrderCountByDateCondition(OrderSearchBean order);


    BigDecimal selectorderamountforwap(Order order);

    /***
     * 获取到货7日后未分红未退货的订单列表
     * @return
     */
    List<Order> selectUnbonusOrders();

    /****
     * 会员消费额统计，会员等级
     * @return
     */
    List<Order> orderBalance(Order order);

    List<Order> findOrderWithGoodsByCondition(Order order);

    List<OrderVo> selectByOrderBatchNumber(String orderBatchNumber);

    List<Integer> findLastMonthOrderStoreIds();

    //上月确认订单数据列表
    List<Order> findLastMonthOrderWithGoodsByCondition(Order param);

    //获取送朋友的订单并且是从不同的店铺购物的支付号
    List<Long> findOrderBatchNumber(Order order);
}